
package se.sll.service.catalogue.product.api.resource;

import java.util.List;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Response;
import se.sll.service.catalogue.product.api.model.Code;
import se.sll.service.catalogue.product.api.model.CodeCreate;
import se.sll.service.catalogue.product.api.model.CodeDelete;
import se.sll.service.catalogue.product.api.model.CodeResponse;
import se.sll.service.catalogue.product.api.model.CodeSystemCreate;
import se.sll.service.catalogue.product.api.model.CodeSystemDelete;
import se.sll.service.catalogue.product.api.model.CodeSystemList;


/**
 * Service for creating, updating, reading code systems.
 * 
 */
@Path("codesystems")
public interface CodeSystemService {


    /**
     * List all stored code systems
     * 
     */
    @GET
    @Produces({
        "application/json"
    })
    CodeSystemService.GetCodesystemsResponse getCodesystems()
        throws Exception
    ;

    /**
     * Create a new code system
     * 
     * @param entity
     *      e.g. {
     *       "oid" : "6.2.9.364.123.7",
     *       "name : "Koder för klassificering av struturell papperstäthet i beganade kaffemuggar",
     *       "description" : "En beskrivning"
     *     }
     *     
     */
    @POST
    @Consumes("application/json")
    CodeSystemService.PostCodesystemsResponse postCodesystems(CodeSystemCreate entity)
        throws Exception
    ;

    /**
     * Update a code system
     * 
     * @param entity
     *      e.g. {
     *       "oid" : "6.2.9.364.123.7",
     *       "name : "Koder för klassificering av struturell papperstäthet i beganade kaffemuggar",
     *       "description" : "En beskrivning"
     *     }
     *     
     */
    @PUT
    @Consumes("application/json")
    CodeSystemService.PutCodesystemsResponse putCodesystems(CodeSystemCreate entity)
        throws Exception
    ;

    /**
     * Reads information about the code system with the specified OID
     * 
     * @param codeSystem
     *     
     */
    @GET
    @Path("{codeSystem}")
    @Produces({
        "application/json"
    })
    CodeSystemService.GetCodesystemsByCodeSystemResponse getCodesystemsByCodeSystem(
        @PathParam("codeSystem")
        String codeSystem)
        throws Exception
    ;

    /**
     * Delete the code system with the specified OID
     * 
     * @param codeSystem
     *     
     * @param entity
     *      e.g. {
     *       "oid" : "1.5.2.6.8.3.3"
     *     }
     *     
     */
    @DELETE
    @Path("{codeSystem}")
    @Consumes("application/json")
    CodeSystemService.DeleteCodesystemsByCodeSystemResponse deleteCodesystemsByCodeSystem(
        @PathParam("codeSystem")
        String codeSystem, CodeSystemDelete entity)
        throws Exception
    ;

    /**
     * Fetches all the codes for the specified Code System OID.
     * 
     * @param codeSystem
     *     
     */
    @GET
    @Path("{codeSystem}/codes")
    @Produces({
        "application/json"
    })
    CodeSystemService.GetCodesystemsByCodeSystemCodesResponse getCodesystemsByCodeSystemCodes(
        @PathParam("codeSystem")
        String codeSystem)
        throws Exception
    ;

    /**
     * Creates a new code entry in the specified Code System.
     * 
     * @param codeSystem
     *     
     * @param entity
     *      e.g. {
     *       "code": "1335",
     *       "description": "Verksamhet d\u00e4r man handl\u00e4gger \u00f6gonsjukdomar.",
     *       "displayName": "\u00d6gonsjukv\u00e5rd"
     *     }
     *     
     */
    @POST
    @Path("{codeSystem}/codes")
    @Consumes("application/json")
    CodeSystemService.PostCodesystemsByCodeSystemCodesResponse postCodesystemsByCodeSystemCodes(
        @PathParam("codeSystem")
        String codeSystem, CodeCreate entity)
        throws Exception
    ;

    /**
     * Updates a code entry in the specified Code System.
     * 
     * @param codeSystem
     *     
     * @param entity
     *      e.g. {
     *       "code": "1335",
     *       "description": "Verksamhet d\u00e4r man handl\u00e4gger \u00f6gonsjukdomar.",
     *       "displayName": "\u00d6gonsjukv\u00e5rd"
     *     }
     *     
     */
    @PUT
    @Path("{codeSystem}/codes")
    @Consumes("application/json")
    CodeSystemService.PutCodesystemsByCodeSystemCodesResponse putCodesystemsByCodeSystemCodes(
        @PathParam("codeSystem")
        String codeSystem, CodeCreate entity)
        throws Exception
    ;

    /**
     * Delete a code with the specfied Code System.
     * 
     * @param codeSystem
     *     
     * @param entity
     *      e.g. {
     *       "code" : "1337"
     *     }
     *     
     */
    @DELETE
    @Path("{codeSystem}/codes")
    @Consumes("application/json")
    CodeSystemService.DeleteCodesystemsByCodeSystemCodesResponse deleteCodesystemsByCodeSystemCodes(
        @PathParam("codeSystem")
        String codeSystem, CodeDelete entity)
        throws Exception
    ;

    /**
     * Find codes by codeSystem and codeName, codeName will be used with wildcards.
     * 
     * @param codeSystem
     *     
     * @param name
     *     
     */
    @GET
    @Path("{codeSystem}/codes/{name}")
    @Produces({
        "application/json"
    })
    CodeSystemService.GetCodesystemsByCodeSystemCodesByNameResponse getCodesystemsByCodeSystemCodesByName(
        @PathParam("name")
        String name,
        @PathParam("codeSystem")
        String codeSystem)
        throws Exception
    ;

    /**
     * Fetches all the codes for all the code systems.
     * 
     */
    @GET
    @Path("codes")
    @Produces({
        "application/json"
    })
    CodeSystemService.GetCodesystemsCodesResponse getCodesystemsCodes()
        throws Exception
    ;

    /**
     * List all Codes whos description contains the provided string, regardless of Code System.
     * 
     * @param description
     *     
     */
    @GET
    @Path("codes/descriptioncontains/{description}")
    @Produces({
        "application/json"
    })
    CodeSystemService.GetCodesystemsCodesDescriptioncontainsByDescriptionResponse getCodesystemsCodesDescriptioncontainsByDescription(
        @PathParam("description")
        String description)
        throws Exception
    ;

    /**
     * List all Codes whos name contains the provided string, regardless of Code System.
     * 
     * @param displayName
     *     
     */
    @GET
    @Path("codes/displaynamecontains/{displayName}")
    @Produces({
        "application/json"
    })
    CodeSystemService.GetCodesystemsCodesDisplaynamecontainsByDisplayNameResponse getCodesystemsCodesDisplaynamecontainsByDisplayName(
        @PathParam("displayName")
        String displayName)
        throws Exception
    ;

    /**
     * Find codes by name, regardless of code system
     * 
     * @param name
     *     
     */
    @GET
    @Path("codes/{name}")
    @Produces({
        "application/json"
    })
    CodeSystemService.GetCodesystemsCodesByNameResponse getCodesystemsCodesByName(
        @PathParam("name")
        String name)
        throws Exception
    ;

    public class DeleteCodesystemsByCodeSystemCodesResponse
        extends se.sll.service.catalogue.product.api.support.ResponseWrapper
    {


        private DeleteCodesystemsByCodeSystemCodesResponse(Response delegate) {
            super(delegate);
        }

        /**
         * The deletion was successful
         * 
         */
        public static CodeSystemService.DeleteCodesystemsByCodeSystemCodesResponse oK() {
            Response.ResponseBuilder responseBuilder = Response.status(200);
            return new CodeSystemService.DeleteCodesystemsByCodeSystemCodesResponse(responseBuilder.build());
        }

    }

    public class DeleteCodesystemsByCodeSystemResponse
        extends se.sll.service.catalogue.product.api.support.ResponseWrapper
    {


        private DeleteCodesystemsByCodeSystemResponse(Response delegate) {
            super(delegate);
        }

        /**
         * The deletion was successful
         * 
         */
        public static CodeSystemService.DeleteCodesystemsByCodeSystemResponse oK() {
            Response.ResponseBuilder responseBuilder = Response.status(200);
            return new CodeSystemService.DeleteCodesystemsByCodeSystemResponse(responseBuilder.build());
        }

    }

    public class GetCodesystemsByCodeSystemCodesByNameResponse
        extends se.sll.service.catalogue.product.api.support.ResponseWrapper
    {


        private GetCodesystemsByCodeSystemCodesByNameResponse(Response delegate) {
            super(delegate);
        }

        /**
         *  e.g. {
         *   "code" : "157H",
         *   "displayName" : "Code displayname",
         *   "description" : "Code description",
         *   "oid" : "1.2.4.5"
         * }
         * 
         * 
         * @param entity
         *     {
         *       "code" : "157H",
         *       "displayName" : "Code displayname",
         *       "description" : "Code description",
         *       "oid" : "1.2.4.5"
         *     }
         *     
         */
        public static CodeSystemService.GetCodesystemsByCodeSystemCodesByNameResponse jsonOK(CodeResponse entity) {
            Response.ResponseBuilder responseBuilder = Response.status(200).header("Content-Type", "application/json");
            responseBuilder.entity(entity);
            return new CodeSystemService.GetCodesystemsByCodeSystemCodesByNameResponse(responseBuilder.build());
        }

    }

    public class GetCodesystemsByCodeSystemCodesResponse
        extends se.sll.service.catalogue.product.api.support.ResponseWrapper
    {


        private GetCodesystemsByCodeSystemCodesResponse(Response delegate) {
            super(delegate);
        }

        /**
         * The requested Code System was found and its Codes are returned in the body. e.g. [
         *   {
         *     "oid" : "1.2.4.5",
         *     "code" : "157H",
         *     "description" : "Code description",
         *     "displayName" : "Code displayname",
         *     "CodeSystem" : "Name of the Code System indicated by the OID"
         *   }
         * ]
         * 
         * 
         * @param entity
         *     [
         *       {
         *         "oid" : "1.2.4.5",
         *         "code" : "157H",
         *         "description" : "Code description",
         *         "displayName" : "Code displayname",
         *         "CodeSystem" : "Name of the Code System indicated by the OID"
         *       }
         *     ]
         *     
         */
        public static CodeSystemService.GetCodesystemsByCodeSystemCodesResponse jsonOK(List<Code> entity) {
            Response.ResponseBuilder responseBuilder = Response.status(200).header("Content-Type", "application/json");
            responseBuilder.entity(entity);
            return new CodeSystemService.GetCodesystemsByCodeSystemCodesResponse(responseBuilder.build());
        }

    }

    public class GetCodesystemsByCodeSystemResponse
        extends se.sll.service.catalogue.product.api.support.ResponseWrapper
    {


        private GetCodesystemsByCodeSystemResponse(Response delegate) {
            super(delegate);
        }

        /**
         * The requested code system was found and is returned in the body. e.g. {
         *   "codes": [
         *     {
         *       "code": "1512",
         *       "codeSystem": null,
         *       "description": "Verksamhet d\u00e4r man erbjuder v\u00e5rd till personer som traumatiserats av krig och tortyr.",
         *       "displayName": "Krigs- och tortyrskadev\u00e5rd",
         *       "oid": "1.2.752.129.2.2.1.3"
         *     },
         *     {
         *       "code": "1335",
         *       "codeSystem": null,
         *       "description": "Verksamhet d\u00e4r man handl\u00e4gger \u00f6gonsjukdomar.",
         *       "displayName": "\u00d6gonsjukv\u00e5rd",
         *       "oid": "1.2.752.129.2.2.1.3"
         *     }
         *   ],
         *   "description": "Koder f\u00f6r v\u00e5rdtyper enligt SLL-EK",
         *   "name": "SLL-EK v\u00e5rdtyper",
         *   "oid": "1.2.752.97.3.1.11"
         * }
         * 
         * 
         * @param entity
         *     {
         *       "codes": [
         *         {
         *           "code": "1512",
         *           "codeSystem": null,
         *           "description": "Verksamhet d\u00e4r man erbjuder v\u00e5rd till personer som traumatiserats av krig och tortyr.",
         *           "displayName": "Krigs- och tortyrskadev\u00e5rd",
         *           "oid": "1.2.752.129.2.2.1.3"
         *         },
         *         {
         *           "code": "1335",
         *           "codeSystem": null,
         *           "description": "Verksamhet d\u00e4r man handl\u00e4gger \u00f6gonsjukdomar.",
         *           "displayName": "\u00d6gonsjukv\u00e5rd",
         *           "oid": "1.2.752.129.2.2.1.3"
         *         }
         *       ],
         *       "description": "Koder f\u00f6r v\u00e5rdtyper enligt SLL-EK",
         *       "name": "SLL-EK v\u00e5rdtyper",
         *       "oid": "1.2.752.97.3.1.11"
         *     }
         *     
         */
        public static CodeSystemService.GetCodesystemsByCodeSystemResponse jsonOK(CodeSystemList entity) {
            Response.ResponseBuilder responseBuilder = Response.status(200).header("Content-Type", "application/json");
            responseBuilder.entity(entity);
            return new CodeSystemService.GetCodesystemsByCodeSystemResponse(responseBuilder.build());
        }

    }

    public class GetCodesystemsCodesByNameResponse
        extends se.sll.service.catalogue.product.api.support.ResponseWrapper
    {


        private GetCodesystemsCodesByNameResponse(Response delegate) {
            super(delegate);
        }

        /**
         * The requested Codes are returned in the body. e.g. [
         *   {
         *     "oid" : "1.2.4.5",
         *     "code" : "157H",
         *     "description" : "Code description",
         *     "displayName" : "Code displayname",
         *     "CodeSystem" : "Name of the Code System indicated by the OID"
         *   }
         * ]
         * 
         * 
         * @param entity
         *     [
         *       {
         *         "oid" : "1.2.4.5",
         *         "code" : "157H",
         *         "description" : "Code description",
         *         "displayName" : "Code displayname",
         *         "CodeSystem" : "Name of the Code System indicated by the OID"
         *       }
         *     ]
         *     
         */
        public static CodeSystemService.GetCodesystemsCodesByNameResponse jsonOK(List<Code> entity) {
            Response.ResponseBuilder responseBuilder = Response.status(200).header("Content-Type", "application/json");
            responseBuilder.entity(entity);
            return new CodeSystemService.GetCodesystemsCodesByNameResponse(responseBuilder.build());
        }

    }

    public class GetCodesystemsCodesDescriptioncontainsByDescriptionResponse
        extends se.sll.service.catalogue.product.api.support.ResponseWrapper
    {


        private GetCodesystemsCodesDescriptioncontainsByDescriptionResponse(Response delegate) {
            super(delegate);
        }

        /**
         * The requested Code information was found and is returned in the body. e.g. [
         *   {
         *     "oid" : "1.2.4.5",
         *     "code" : "157H",
         *     "description" : "Code description",
         *     "displayName" : "Code displayname",
         *     "CodeSystem" : "Name of the Code System indicated by the OID"
         *   }
         * ]
         * 
         * @param entity
         *     [
         *       {
         *         "oid" : "1.2.4.5",
         *         "code" : "157H",
         *         "description" : "Code description",
         *         "displayName" : "Code displayname",
         *         "CodeSystem" : "Name of the Code System indicated by the OID"
         *       }
         *     ]
         */
        public static CodeSystemService.GetCodesystemsCodesDescriptioncontainsByDescriptionResponse jsonOK(List<Code> entity) {
            Response.ResponseBuilder responseBuilder = Response.status(200).header("Content-Type", "application/json");
            responseBuilder.entity(entity);
            return new CodeSystemService.GetCodesystemsCodesDescriptioncontainsByDescriptionResponse(responseBuilder.build());
        }

    }

    public class GetCodesystemsCodesDisplaynamecontainsByDisplayNameResponse
        extends se.sll.service.catalogue.product.api.support.ResponseWrapper
    {


        private GetCodesystemsCodesDisplaynamecontainsByDisplayNameResponse(Response delegate) {
            super(delegate);
        }

        /**
         * The requested Code information was found and is returned in the body. e.g. [
         *   {
         *     "oid" : "1.2.4.5",
         *     "code" : "157H",
         *     "description" : "Code description",
         *     "displayName" : "Code displayname",
         *     "CodeSystem" : "Name of the Code System indicated by the OID"
         *   }
         * ]
         * 
         * 
         * @param entity
         *     [
         *       {
         *         "oid" : "1.2.4.5",
         *         "code" : "157H",
         *         "description" : "Code description",
         *         "displayName" : "Code displayname",
         *         "CodeSystem" : "Name of the Code System indicated by the OID"
         *       }
         *     ]
         *     
         */
        public static CodeSystemService.GetCodesystemsCodesDisplaynamecontainsByDisplayNameResponse jsonOK(List<Code> entity) {
            Response.ResponseBuilder responseBuilder = Response.status(200).header("Content-Type", "application/json");
            responseBuilder.entity(entity);
            return new CodeSystemService.GetCodesystemsCodesDisplaynamecontainsByDisplayNameResponse(responseBuilder.build());
        }

    }

    public class GetCodesystemsCodesResponse
        extends se.sll.service.catalogue.product.api.support.ResponseWrapper
    {


        private GetCodesystemsCodesResponse(Response delegate) {
            super(delegate);
        }

        /**
         * The requested Codes are returned in the body. e.g. [
         *   {
         *     "oid" : "1.2.4.5",
         *     "code" : "157H",
         *     "description" : "Code description",
         *     "displayName" : "Code displayname",
         *     "CodeSystem" : "Name of the Code System indicated by the OID"
         *   }
         * ]
         * 
         * 
         * @param entity
         *     [
         *       {
         *         "oid" : "1.2.4.5",
         *         "code" : "157H",
         *         "description" : "Code description",
         *         "displayName" : "Code displayname",
         *         "CodeSystem" : "Name of the Code System indicated by the OID"
         *       }
         *     ]
         *     
         */
        public static CodeSystemService.GetCodesystemsCodesResponse jsonOK(List<Code> entity) {
            Response.ResponseBuilder responseBuilder = Response.status(200).header("Content-Type", "application/json");
            responseBuilder.entity(entity);
            return new CodeSystemService.GetCodesystemsCodesResponse(responseBuilder.build());
        }

    }

    public class GetCodesystemsResponse
        extends se.sll.service.catalogue.product.api.support.ResponseWrapper
    {


        private GetCodesystemsResponse(Response delegate) {
            super(delegate);
        }

        /**
         * The requested code system information was found and is returned in the body. e.g. [
         *   {
         *     "codes": [
         *       {
         *         "code": "1512",
         *         "codeSystem": null,
         *         "description": "Verksamhet d\u00e4r man erbjuder v\u00e5rd till personer som traumatiserats av krig och tortyr.",
         *         "displayName": "Krigs- och tortyrskadev\u00e5rd",
         *         "oid": "1.2.752.129.2.2.1.3"
         *       },
         *       {
         *         "code": "1335",
         *         "codeSystem": null,
         *         "description": "Verksamhet d\u00e4r man handl\u00e4gger \u00f6gonsjukdomar.",
         *         "displayName": "\u00d6gonsjukv\u00e5rd",
         *         "oid": "1.2.752.129.2.2.1.3"
         *       }
         *     ],
         *     "description": "Koder f\u00f6r v\u00e5rdtyper enligt SLL-EK",
         *     "name": "SLL-EK v\u00e5rdtyper",
         *     "oid": "1.2.752.97.3.1.11"
         *   }
         * ]
         * 
         * 
         * @param entity
         *     [
         *       {
         *         "codes": [
         *           {
         *             "code": "1512",
         *             "codeSystem": null,
         *             "description": "Verksamhet d\u00e4r man erbjuder v\u00e5rd till personer som traumatiserats av krig och tortyr.",
         *             "displayName": "Krigs- och tortyrskadev\u00e5rd",
         *             "oid": "1.2.752.129.2.2.1.3"
         *           },
         *           {
         *             "code": "1335",
         *             "codeSystem": null,
         *             "description": "Verksamhet d\u00e4r man handl\u00e4gger \u00f6gonsjukdomar.",
         *             "displayName": "\u00d6gonsjukv\u00e5rd",
         *             "oid": "1.2.752.129.2.2.1.3"
         *           }
         *         ],
         *         "description": "Koder f\u00f6r v\u00e5rdtyper enligt SLL-EK",
         *         "name": "SLL-EK v\u00e5rdtyper",
         *         "oid": "1.2.752.97.3.1.11"
         *       }
         *     ]
         *     
         */
        public static CodeSystemService.GetCodesystemsResponse jsonOK(List<CodeSystemList> entity) {
            Response.ResponseBuilder responseBuilder = Response.status(200).header("Content-Type", "application/json");
            responseBuilder.entity(entity);
            return new CodeSystemService.GetCodesystemsResponse(responseBuilder.build());
        }

    }

    public class PostCodesystemsByCodeSystemCodesResponse
        extends se.sll.service.catalogue.product.api.support.ResponseWrapper
    {


        private PostCodesystemsByCodeSystemCodesResponse(Response delegate) {
            super(delegate);
        }

        /**
         * Creation successful.
         * 
         */
        public static CodeSystemService.PostCodesystemsByCodeSystemCodesResponse created() {
            Response.ResponseBuilder responseBuilder = Response.status(201);
            return new CodeSystemService.PostCodesystemsByCodeSystemCodesResponse(responseBuilder.build());
        }

    }

    public class PostCodesystemsResponse
        extends se.sll.service.catalogue.product.api.support.ResponseWrapper
    {


        private PostCodesystemsResponse(Response delegate) {
            super(delegate);
        }

        /**
         * Creation successful.
         * 
         */
        public static CodeSystemService.PostCodesystemsResponse created() {
            Response.ResponseBuilder responseBuilder = Response.status(201);
            return new CodeSystemService.PostCodesystemsResponse(responseBuilder.build());
        }

    }

    public class PutCodesystemsByCodeSystemCodesResponse
        extends se.sll.service.catalogue.product.api.support.ResponseWrapper
    {


        private PutCodesystemsByCodeSystemCodesResponse(Response delegate) {
            super(delegate);
        }

        /**
         * Update successful.
         * 
         */
        public static CodeSystemService.PutCodesystemsByCodeSystemCodesResponse oK() {
            Response.ResponseBuilder responseBuilder = Response.status(200);
            return new CodeSystemService.PutCodesystemsByCodeSystemCodesResponse(responseBuilder.build());
        }

    }

    public class PutCodesystemsResponse
        extends se.sll.service.catalogue.product.api.support.ResponseWrapper
    {


        private PutCodesystemsResponse(Response delegate) {
            super(delegate);
        }

        /**
         * Update successful.
         * 
         */
        public static CodeSystemService.PutCodesystemsResponse oK() {
            Response.ResponseBuilder responseBuilder = Response.status(200);
            return new CodeSystemService.PutCodesystemsResponse(responseBuilder.build());
        }

    }

}
